﻿using System.Collections.Generic;
using System.Web.Http;

namespace IceDog.DNF.Program.WebApi2.Controllers
{
    public class ActionController : ApiController
    {
        // GET: api/Action
        [HttpGet,AcceptVerbs("GET","HEAD")]
        public IEnumerable<string> Get()
        {
            return new string[] { "get", "all","data" };
        }

        // GET: api/Action/5
        [HttpGet]
        [AcceptVerbs("MKCOL")]// WebDAV method
        public string Get(int id)
        {
            return "get a single data by id="+id;
        }

        // POST: api/Action
        [HttpPost]
        public string Post([FromBody]string value)
        {
            return "add a data to server , data=" + value;
        }

        // PUT: api/Action/5
        [HttpPut]
        public string Put(int id, [FromBody]string value)
        {
            return "update a data from server ,its id="+id+", data=" + value;
        }
        // PATCH: api/Action/5
        [HttpPatch]
        public string Patch(int id, [FromBody]string value)
        {
            return "local update a data from server ,its id=" + id + ", data=" + value;
        }

        // DELETE: api/Action/5
        [HttpDelete]
        public string Delete(int id)
        {
            return "delete a data from server ,its id=" + id;
        }
    }
}
